package main

import (
	"fmt"
	"time"
)

func main() {
	sum :=0
	for i:=0; i<=100; i++ {
		sum +=i
	}
	fmt.Println("1+2+3+***+99+100=",sum)
	// 迭代每一个元素
	var str string = "abcde"
	for i:=0;i<len(str);i++ {
		fmt.Printf("str[%d]=%c\n",i,str[i])
	}

	for i, item := range str{
		fmt.Printf("str[%d]=%c\n",i,item)
	}
	for i, _ := range str{
		fmt.Printf("str[%d]=%c\n",i,str[i])
	}

	x:= 0
	for {
		x++
		fmt.Println("i=",x)
		time.Sleep(time.Second)
	}

}